package MyThread_demo.StampedLock_demo;

/**
 * @author ChenYongHao
 * @date 2023/5/4 15:02
 * @desc 测试读-读：
 */
public class TestReadReadStamped {
    public static void main(String[] args) {
        DataContainerStamped dataContainer = new DataContainerStamped(123456);
        new Thread(() -> {
            try {
                int data = dataContainer.read();
                System.out.println(data);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "t1").start();
        new Thread(() -> {
            try {
                int data = dataContainer.read();
                System.out.println(data);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }, "t2").start();
    }
}

